#ifndef SQLITE_COMMAND_INTERFACE_H
#define SQLITE_COMMAND_INTERFACE_H

#include <stdint.h>
#include <QVariant>
#include <QSqlDatabase>
#include <QSqlError>
#include <QSqlQuery>
#include <QDebug>

class SqliteCommandInterface
{
public:
    // 各自命令处理各自错误
    virtual bool Execute(const QSqlDatabase &database) = 0;
};

class AddPersonCommand : public SqliteCommandInterface {
public:
    AddPersonCommand(int32_t id, QString name, int32_t age);
    bool Execute(const QSqlDatabase &database) override;
private:
    int32_t id_;
    QString name_;
    int32_t age_;
};

class InsertPersonCommand : public SqliteCommandInterface {
public:
    InsertPersonCommand(QString name, int32_t age);
    bool Execute(const QSqlDatabase &database) override;
private:
    QString name_;
    int32_t age_;
};

class UpdatePersonCommand : public SqliteCommandInterface {
public:
    UpdatePersonCommand(int32_t id, QString name, int32_t age);
    bool Execute(const QSqlDatabase &database) override;
private:
    int32_t id_;
    QString name_;
    int32_t age_;
};

#endif // SQLITE_COMMAND_INTERFACE_H
